package com.finance.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Http请求返回信息
 */
public class HttpResponese {

    // redirect跳转地址
    private List<String> redirectUrls = new ArrayList<String>();
    // responese返回头
    private Map<String, String> header = new HashMap<String, String>();
    // HTTP返回code，200 成功，其余失败
    private int statusCode = 0;
    private String text;
    private String finalUrl;

    private List<Exception> exceptions;

    public List<String> getRedirectUris() {
        return redirectUrls;
    }

    public Map<String, String> getHeader() {
        return header;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void addRedirectUrl(String redirectUrl) {
        this.redirectUrls.add(redirectUrl);
    }

    public void addHeader(String key, String value) {
        this.header.put(key, value);
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public List<Exception> getExceptions() {
        return exceptions;
    }

    public void addException(Exception e){
        if(exceptions == null){
            exceptions = new ArrayList<>();
        }
        exceptions.add(e);
    }

    public String getFinalUrl() {
        return finalUrl;
    }

    public void setFinalUrl(String finalUrl) {
        this.finalUrl = finalUrl;
    }
}
